package com.abso.mp3tunes.locker.ui.actions;

import org.eclipse.jface.action.Action;

import com.abso.mp3tunes.locker.ui.LockerImages;
import com.abso.mp3tunes.locker.ui.views.LockerBrowserView;

/**
 * Action able to refresh the current Locker tree viewer.
 */
public class RefreshAction extends Action {

	/** The Locker browser view. */
	private LockerBrowserView lockerBrowser;

	/**
	 * Constructs a new action.
	 * 
	 * @param lockerBrowser
	 *            the Locker browser.
	 */
	public RefreshAction(LockerBrowserView lockerBrowser) {
		super("", LockerImages.getDescriptor(LockerImages.REFRESH));
		setToolTipText("Refresh");
		this.lockerBrowser = lockerBrowser;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
	public void run() {
		lockerBrowser.setCurrentViewerDirty();
		lockerBrowser.refreshCurrentViewer();
	}

}
